<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加话题</title>
<link rel="stylesheet" type="text/css" href="/bbs/css/title.css"/>

<script type="text/javascript">
       function myCheck()
            {
               for(var i=0;i<document.form1.elements.length-1;i++)
               {
            	   var str = document.form1.elements[i].value;
                  if(str.replace(/^(\s|\u00A0)+/,'').replace(/(\s|\u00A0)+$/,'') == "")
                  {
                     alert("当前表单不能有空项");
                     document.form1.elements[i].focus();
                     return false;
                  }
               }
               alert("添加成功");
               return true;
            }
        </script>

</head>
<body>
		<a href="/bbs/back_servlet"><font style="font-size: 24px;">返回</font></a>
		<form action="/bbs/insert_servlet" name="form1"  method="post" onsubmit="return myCheck()">
			<table class="All_table">
				<caption><font color="red" size="6px">话题添加</font></caption>
				<tr>
					<th class="all_td_th">话题标题:</th>
				</tr>
				<tr>
					<td class="all_td_th"><input class="text_title" type="text"  name="thead"/></td>
				</tr>
				<tr>
					<th class="all_td_th">话题内容:</th>
				</tr>
				<tr>
					<td class="all_td_th">
					<textarea class="text_content" name="tcontent"  rows="20" cols="80"></textarea></td>
				</tr>
				<tr>
					<td  class="all_td_th" colspan="2"><input type="reset" name="chongxie" value="重填"/>
					&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="添加" /></td>
				</tr>
			</table>
		</form>
		<div class="insertYes">
			<%
				Boolean insertYes = (Boolean)request.getSession().getAttribute("insertYes");//获取添加状态信息 添加成功或失败给予用户提示
				if(insertYes !=null && insertYes){ %>
					<jsp:include page="insertYes.jsp"></jsp:include> <%--引入提示页面 --%>
			<%	request.getSession().removeAttribute("insertYes"); //删除状态信息 防止后续操作时 页面出错
			} else if(insertYes != null && insertYes!=true){%>	
				<jsp:include page="insertError.jsp"></jsp:include><%--引入提示页面 --%>
			<% request.getSession().removeAttribute("insertYes"); //删除状态信息 防止后续操作时 页面出错
			} %>
		</div>
		<script type="text/javascript">
			
		</script>
		
</body>
</html>